/*
 *  $Id: Affect.cs 881 2009-11-24 19:51:45Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima {
    /// <summary>
    /// Условие на наличие/отсутствие определенного эффекта на кастере
    /// </summary>
    public class AffectCondition<T>: Condition where T: Affect {
        private Languages.Phrase _notice;
        private bool _existence;

        public AffectCondition(Languages.Phrase notice, bool existence) {
            _notice = notice;
            _existence = existence;
        }

        public override bool Test(AbstractObject caster, Card card) {
            bool result = caster.HasAffect<T>();
            return _existence ? result : !result;
        }

        public override Languages.Phrase Notice {
            get { return _notice; }
        }
    }
}
